package com.example.edupublisher.service.imp;

import com.example.edupublisher.bean.TrafficVisitorStatsPerHour;
import com.example.edupublisher.bean.TrafficVisitorTypeStats;
import com.example.edupublisher.mapper.TrafficVisitorStatsMapper;
import com.example.edupublisher.service.TrafficVisitorStatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName: TrafficVisitorStatsServiceImpl
 * Package: com.atguigu.edu.publisher.service.impl
 * Description:
 *
 * @Author Mr.2
 * @Create 2023/9/11 11:58
 * @Version 1.0
 */
@Service
public class TrafficVisitorStatsServiceImpl implements TrafficVisitorStatsService {

    // 自动状态Mapper接口实现类
    @Autowired
    TrafficVisitorStatsMapper trafficVisitorStatsMapper;

    // 1. 获取分时流量统计数据
    @Override
    public List<TrafficVisitorStatsPerHour> getVisitorPerHrStats(Integer date) {
        return trafficVisitorStatsMapper.selectVisitorStatsPerHr(date);
    }

    // 2. 新老访客流量统计
    @Override
    public List<TrafficVisitorTypeStats> getVisitorTypeStats(Integer date) {
        return trafficVisitorStatsMapper.selectVisitorTyoeStats(date);
    }
}
